package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 备品基础信息对象 MB_ERP_EQUIPMENT_MATERIAL
 *
 * @author Cheng
 * @date 2023-06-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_MATERIAL")
@Schema(description="备品基础信息")
public class EquipmentMaterial extends BaseEntity {

private static final long serialVersionUID=1L;


    @Id
    @Generator
    @Column(name = "ID_", updatable = false)
    @Schema(description = "ID")
    private String id;

    @Column(name = "NAME_")
    @Schema(description = "备品名称")
    private String name;

    @Column(name = "CODE_")
    @Schema(description = "备品编码")
    private String code;

    @Dict(dicEntity =EquipmentMaterialCategory.class, dicText = "name", dicCode = "id")
    @Column(name = "CATEGORY_ID_")
    @Schema(description = "所属分类")
    private String categoryId;
    @Transient
    @Schema(description = "所属分类")
    private String categoryName;
    @Column(name = "PRODUCT_NAME_")
    @Schema(description = "品名")
    private String productName;

    @Column(name = "BRAND_")
    @Schema(description = "品牌")
    private String brand;

    @Column(name = "SPEC_")
    @Schema(description = "规格型号")
    private String spec;

    @Column(name = "STOCK_UNIT_")
    @Schema(description = "库存单位")
    private String stockUnit;

    @Column(name = "ES_PRICE_")
    @Schema(description = "预估单价")
    private BigDecimal esPrice;

    @Dict(dicCode = "ERP_EQUIPMENT_PURCHASE_TYPE")
    @Column(name = "PURCHASE_TYPE_")
    @Schema(description = "购买类型")
    private String purchaseType;

    @Column(name = "CERTIFICATE_")
    @Schema(description = "合格证号")
    private String certificate;

    @Column(name = "SAFETY_STOCK_")
    @Schema(description = "安全库存量")
    private Long safetyStock;

    @Column(name = "MAX_STOCK_")
    @Schema(description = "最大库存量")
    private Long maxStock;
    @Dict(dicCode = "ERP_EQUIPMENT_ABC_TYPE")
    @Column(name = "ABC_TYPE_")
    @Schema(description = "ABC码")
    private String abcType;

    @Column(name = "IS_OLD_")
    @Dict(dicCode = "MB_SYSTEM_YES_NO")
    @Schema(description = "是否利旧")
    private Integer isOld;

    @Column(name = "SCRAP_TIME_")
    @Schema(description = "报废时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date scrapTime;

    @Column(name = "FACTORY_ID_")
    @Dict(dicCode = "ERP_EQUIPMENT_FACTORY")
    @Schema(description = "厂区")
    private String factoryId;

    @Column(name = "WARN_TYPE_")
    @Schema(description = "预警响应")
    private Integer warnType;

    @Column(name = "PIC_")
    @Schema(description = "图片")
    private String pic;

    @Column(name = "REMARKS_")
    @Schema(description = "备注")
    private String remarks;

    @Column(name = "IS_DEL_")
    @Schema(description = "是否删除（0-正常；1-删除）")
    private Integer isDel;

}
